<template>
	<view class="bg">
		<!-- 订单选项 -->
		<!-- 代码重复性高无所谓，能用就行 -->
		<view class="tab">
			<view class="tab-item" :class="{ active: selectedTab === 0 }" @tap="selectTab(0)">回收订单</view>
			<view class="tab-item" :class="{ active: selectedTab === 1 }" @tap="selectTab(1)">商城订单</view>

		</view>

		<!-- 回收订单信息 -->
		<view class="order-info" :class="selectedTab === 0?'order-infoActive1':'' " v-show="selectedTab === 0">
			<view class="info-item" :class="{ active1: selectedIndex === index }"
				v-for="(info, index) in recycleOrderInfo" :key="index" @tap="selectOrderInfo(index)">
				<text class="text1"> {{ info }} </text>
			</view>
		</view>

		<!-- 商城订单信息 -->
		<view class="order-info" :class="selectedTab === 1?'order-infoActive2':'' " v-show="selectedTab === 1">
			<view class="info-item" :class="{ active1: selectedIndex === index }" v-for="(info, index) in shopOrderInfo"
				:key="index" @tap="selectOrderInfo(index)">
				<text class="text1"> {{ info }} </text>
			</view>
		</view>



		<!-- 订单信息内容 -->
		<!-- 全部 -->
		<view class="order-content">
			<view class="order-card" v-if="selectedTab === 0&&selectedIndex==0" v-for="(item,index) in advanceOrder"
				:key="index">
				<view class="" @click="navigateToorderDetails(item.id)">


					<view class="content1">
						<view class="text1">
							<text class="dingdan">订 单 号:</text>
							<text class="diangdanid"> {{item.id}}</text>
						</view>
						<text class="text2" v-if="item.stateId === 1">待收取</text>
						<text class="text2" v-if="item.stateId === 2">已完成</text>
						<text class="text2" v-if="item.stateId === 3">已取消</text>
						<text class="text2" v-if="item.stateId === 4">等待上门</text>
					</view>
					<view class="content2">
						<view class="just">
							<view class="cot2">
								<view class="text1">
									<view class="text1-left">
										下单时间:
									</view>
									<view class="text1-right">
										{{item.createTime}}
									</view>
								</view>
								<view class="text1">
									<view class="text1-left">
										预估重量:
									</view>
									<view class="text1-right">
										{{item.minWeight + '-' + item.maxWeight + 'Kg'}}
									</view>
								</view>
							</view>
							<view class="but"> <button class="btn" :style="spdd(item.id)">{{ buttonText }}</button>
							</view>
						</view>

					</view>
					<view class="content4">
						<view class="content4-text">
							<view class="content4-left"> 所属驿站:</view>
							<view class="content4-right">{{item.shopAddress}}</view>
						</view>
						<view class="content4-text content4-address ">
							<view class="content4-left">上门地址:</view>
							<view class="content4-right content4-right-address">{{item.recycleAddress}}</view>
						</view>
						<view class="content4-text">
							<view class="content4-left"> 联系电话:</view>
							<view class="content4-right">{{item.userPhone}}</view>
						</view>
						<text class="text1">
							备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</text>
						<text>{{item.remark}}</text>
					</view>
				</view>
				<view class="content5">
					<view class="input" @click="addremark(item.id)" v-if="item.stateId === 1">
						<u-icon name="edit-pen" color="#2979ff" size="28"></u-icon>
						<text class="textInput">增加备注信息</text>
					</view>
					<view class="input" v-else>

						<text class="textInput"></text>
					</view>

					<text class="text1">联系客服</text>
				</view>


			</view>


		</view>
		<!-- 待收取 -->
		<view class="order-content">
			<view class="order-card" v-if="selectedTab === 0&&selectedIndex==1"
				v-for="(item,index) in waitAppointmentOrder" :key="index">
				<view class="" @click="navigateToorderDetails(item.id)">


					<view class="content1">
						<view class="text1">
							<text class="dingdan">订 单 号:</text>
							<text class="diangdanid"> {{item.id}}</text>
						</view>
						<text class="text2" v-if="item.stateId === 1">待收取</text>
						<text class="text2" v-if="item.stateId === 2">已完成</text>
						<text class="text2" v-if="item.stateId === 3">已取消</text>
					</view>
					<view class="content2">
						<view class="just">
							<view class="cot2">
								<view class="text1">
									<view class="text1-left">
										下单时间:
									</view>
									<view class="text1-right">
										{{item.createTime}}
									</view>
								</view>
								<view class="text1">
									<view class="text1-left">
										预估重量:
									</view>
									<view class="text1-right">
										{{item.minWeight + '-' + item.maxWeight + 'Kg'}}
									</view>
								</view>
							</view>
							<view class="but"> <button class="btn" :style="spdd(item.id)">{{ buttonText }}</button>
							</view>
						</view>

					</view>
					<view class="content4">
						<view class="content4-text">
							<view class="content4-left"> 所属驿站:</view>
							<view class="content4-right">{{item.shopAddress}}</view>
						</view>
						<view class="content4-text content4-address ">
							<view class="content4-left">上门地址:</view>
							<view class="content4-right content4-right-address">{{item.recycleAddress}}</view>
						</view>
						<view class="content4-text">
							<view class="content4-left"> 联系电话:</view>
							<view class="content4-right">{{item.userPhone}}</view>
						</view>
						<text class="text1">
							备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</text>
						<text>{{item.remark}}</text>
					</view>
				</view>
				<view class="content5">
					<view class="input" @click="addremark(item.id)">
						<u-icon name="edit-pen" color="#2979ff" size="28"></u-icon>
						<text class="textInput">增加备注信息</text>
					</view>
					<text class="text1">联系客服</text>
				</view>


			</view>
		</view>
		<!-- 已完成 -->
		<view class="order-content">
			<view class="order-card" v-if="selectedTab === 0&&selectedIndex==2"
				v-for="(item,index) in successAppointmentOrder" :key="index">
				<view class="" @click="navigateToorderDetails(item.id)">


					<view class="content1">
						<view class="text1">
							<text class="dingdan">订 单 号:</text>
							<text class="diangdanid"> {{item.id}}</text>
						</view>
						<text class="text2" v-if="item.stateId === 1">待收取</text>
						<text class="text2" v-if="item.stateId === 2">已完成</text>
						<text class="text2" v-if="item.stateId === 3">已取消</text>
					</view>
					<view class="content2">
						<view class="just">
							<view class="cot2">
								<view class="text1">
									<view class="text1-left">
										下单时间:
									</view>
									<view class="text1-right">
										{{item.createTime}}
									</view>
								</view>
								<view class="text1">
									<view class="text1-left">
										预估重量:
									</view>
									<view class="text1-right">
										{{item.minWeight + '-' + item.maxWeight + 'Kg'}}
									</view>
								</view>
							</view>
							<view class="but"> <button class="btn" :style="spdd(item.id)">{{ buttonText }}</button>
							</view>
						</view>

					</view>
					<view class="content4">
						<view class="content4-text">
							<view class="content4-left"> 所属驿站:</view>
							<view class="content4-right">{{item.shopAddress}}</view>
						</view>
						<view class="content4-text content4-address ">
							<view class="content4-left">上门地址:</view>
							<view class="content4-right content4-right-address">{{item.recycleAddress}}</view>
						</view>
						<view class="content4-text">
							<view class="content4-left"> 联系电话:</view>
							<view class="content4-right">{{item.userPhone}}</view>
						</view>
						<text class="text1">
							备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</text>
						<text>{{item.remark}}</text>
					</view>
				</view>
				<view class="content5">
					<view class="input">
						<text class="textInput"></text>
					</view>
					<text class="text1">联系客服</text>
				</view>


			</view>


		</view>
		<!-- 已取消 -->
		<view class="order-content">
			<view class="order-card" v-if="selectedTab === 0&&selectedIndex==3"
				v-for="(item,index) in cancelledAdvanceOrders" :key="index">
				<view class="" @click="navigateToorderDetails(item.id)">


					<view class="content1">
						<view class="text1">
							<text class="dingdan">订 单 号:</text>
							<text class="diangdanid"> {{item.id}}</text>
						</view>
						<text class="text2" v-if="item.stateId === 1">待收取</text>
						<text class="text2" v-if="item.stateId === 2">已完成</text>
						<text class="text2" v-if="item.stateId === 3">已取消</text>
					</view>
					<view class="content2">
						<view class="just">
							<view class="cot2">
								<view class="text1">
									<view class="text1-left">
										下单时间:
									</view>
									<view class="text1-right">
										{{item.createTime}}
									</view>
								</view>
								<view class="text1">
									<view class="text1-left">
										预估重量:
									</view>
									<view class="text1-right">
										{{item.minWeight + '-' + item.maxWeight + 'Kg'}}
									</view>
								</view>
							</view>
							<view class="but"> <button class="btn" :style="spdd(item.id)">{{ buttonText }}</button>
							</view>
						</view>

					</view>
					<view class="content4">
						<view class="content4-text">
							<view class="content4-left"> 所属驿站:</view>
							<view class="content4-right">{{item.shopAddress}}</view>
						</view>
						<view class="content4-text content4-address ">
							<view class="content4-left">上门地址:</view>
							<view class="content4-right content4-right-address">{{item.recycleAddress}}</view>
						</view>
						<view class="content4-text">
							<view class="content4-left"> 联系电话:</view>
							<view class="content4-right">{{item.userPhone}}</view>
						</view>
						<text class="text1">
							备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</text>
						<text>{{item.remark}}</text>
					</view>
				</view>
				<view class="content5">
					<view class="input" @click="addremark(item.id)">
						<u-icon name="edit-pen" color="#2979ff" size="28"></u-icon>
						<text class="textInput">增加备注信息</text>
					</view>
					<text class="text1">联系客服</text>
				</view>


			</view>


		</view>

		<!-- 商城订单信息 -->
		<!-- 全部 -->
		<view class="order-content">
			<view class="order-card" v-if="selectedTab === 1&&selectedIndex==0" v-for="(item,index) in shoppingOrder"
				:key="index">
				<view class="" @click="navigateToorderDetails(index)">


					<view class="content1">
						<text class="text1">订单号: {{item.id}}</text>
					</view>
					<view class="content2">
						<view class="just">
							<view class="cot2">
								<text class="text1" :value="time"> 下单时间: {{item.createTime}}</text>
								<!-- <text class="text1">下单数量: </text> -->
							</view>
							<view class="but"> <button class="btn" :style="spdd(item.id)">{{ buttonText }}</button>
							</view>
						</view>

					</view>
					<view class="content4">
						<view>
							<view>商品信息:</view>
							<view style="display: flex;">
								<view class="left">
									<image :src="item.images" mode="widthFix"></image>
								</view>
								<view class="right">
									<view class="text">
										{{item.name}}
									</view>
									<!-- <view style="display: flex;">
										<view style="flex: 1; margin-left: 10rpx;">积分:{{item.value}}</view>
										<view style="flex: 1; margin-left: 100rpx; margin-top: 5rpx;">×1</view>
									</view> -->
								</view>
							</view>
						</view>
						<view class="text1">
							<text> 收货地址:</text>
							<text>{{item.addressId}}</text>
						</view>
						<view class="text1">
							<text>备注:</text>
							<text></text>
						</view>
						
					</view>
				</view>
				<view class="content5">
					<view class="input" @click="addremark(item.id)">
						<u-icon name="edit-pen" color="#2979ff" size="28"></u-icon>
						<text class="textInput">增加备注信息</text>
					</view>
					<text class="text1" @click="goto('/pages/link/link')">联系客服</text>
				</view>
			</view>
		</view>

		<!-- 待支付 -->
		<view class="order-content">
			<view class="order-card" v-if="selectedTab === 1 && selectedIndex==1 && item.num=='待支付'"
				v-for="(item,index) in shoppingOrder" :key="index">
				<view class="" @click="navigateToorderDetails(index)">


					<view class="content1">
						<text class="text1">订单号: {{item.id}}</text>
					</view>
					<view class="content2">
						<view class="just">
							<view class="cot2">
								<text class="text1" :value="time"> 下单时间: {{item.createTime}}</text>
								<!-- <text class="text1">下单数量: </text> -->
							</view>
							<view class="but"> <button class="btn" :style="spdd(item.id)">{{ buttonText }}</button>
							</view>
						</view>

					</view>
					<view class="content4">
						<view>
							<view>商品信息:</view>
							<view style="display: flex;">
								<view class="left">
									<image :src="item.image" mode="widthFix"></image>
								</view>
								<view class="right">
									<view class="text">
										{{item.name}}
									</view>
								</view>
							</view>
						</view>
						<view class="text1">
							<text> 收货地址:</text>
							<text>{{item.addressId}}</text>
						</view>
						<!-- <view class="text1">
							<text> 联系电话:</text>
							<text>{{user.phone}}</text>
						</view> -->
						<view class="text1">
							<text>备注:</text>
							<text></text>
						</view>
					</view>
				</view>
				<view class="content5">
					<view class="input" @click="addremark(item.id)">
						<u-icon name="edit-pen" color="#2979ff" size="28"></u-icon>
						<text class="textInput">增加备注信息</text>
					</view>

					<text class="text1" @click="goto('/pages/link/link')">联系客服</text>
				</view>
				<u-divider text="" :dashed="true" lineColor="#5f5f5f"></u-divider>
				<view style="display: flex;  justify-content: flex-end;">
					<view>
						<u-button @click="cancelOrder">取消订单</u-button>
					</view>
					<view>
						<u-button @click="show = true">去支付</u-button>
						<u-popup :show="show" @close="close" @open="open">
							<view class="popup">
								<view class="jifen">
									<text>{{item.value}}</text>
									<text
										style="font-size: 20px; color: aquamarine; margin-left: 10rpx; font-weight: bold;padding-top: 20rpx;">积分</text>
								</view>
								<view class="messege">
									<text class="left">用户姓名</text>
									<text class="right">{{user.name}}</text>
								</view>
								<view class="messege">
									<text class="left">手机号码</text>
									<text class="right">{{user.phone}}</text>
								</view>
								<view class="messege">
									<text class="left">付款方式</text>
									<text class="right">积分兑换</text>
								</view>
								<button class="btn">立即支付</button>
							</view>
						</u-popup>

					</view>
				</view>

			</view>
		</view>

		<!-- 待配送 -->
		<view class="order-content">
			<view class="order-card" v-if="selectedTab === 1 && selectedIndex==2 && item.num=='待配送'"
				v-for="(item,index) in shoppingOrder" :key="index">
				<view class="" @click="navigateToorderDetails(index)">


					<view class="content1">
						<text class="text1">订单号: {{item.id}}</text>
					</view>
					<view class="content2">
						<view class="just">
							<view class="cot2">
								<text class="text1"> 下单时间: {{item.createTime}}</text>
								<!-- <text class="text1">下单数量: </text> -->
							</view>
							<view class="but"> <button class="btn" :style="spdd(item.id)">{{ buttonText }}</button>
							</view>
						</view>

					</view>
					<view class="content4">
						<view>
							<view>商品信息:</view>
							<view style="display: flex;">
								<view class="left">
									<image :src="item.images" mode="widthFix"></image>
								</view>
								<view class="right">
									<view class="text">
										{{item.name}}
									</view>
									<!-- <view style="display: flex;">
										<view style="flex: 1; margin-left: 10rpx;">积分: {{item.value}}</view>
										<view style="flex: 1; margin-left: 100rpx; margin-top: 5rpx;">×1</view>
									</view> -->
								</view>
							</view>
						</view>
						<view class="text1">
							<text> 收货地址:</text>
							<text>{{item.addressId}}</text>
						</view>
						<!-- <view class="text1">
							<text> 联系电话:</text>
							<text>{{user.phone}}</text>
						</view> -->
						<view class="text1">
							<text>备注:</text>
							<text></text>
						</view>
					</view>
				</view>
				<view class="content5">
					<view class="input" @click="addremark(item.id)">
						<u-icon name="edit-pen" color="#2979ff" size="28"></u-icon>
						<text class="textInput">增加备注信息</text>
					</view>

					<text class="text1" @click="goto('/pages/link/link')">联系客服</text>
				</view>


			</view>
		</view>


		<!-- 已完成 -->
		<view class="order-content">
			<view class="order-card" v-if="selectedTab === 1 && selectedIndex==4 && item.num=='已完成'"
				v-for="(item,index) in shoppingOrder" :key="index">
				<view class="" @click="navigateToorderDetails(index)">


					<view class="content1">
						<text class="text1">订单号: {{item.id}}</text>
					</view>
					<view class="content2">
						<view class="just">
							<view class="cot2">
								<text class="text1"> 下单时间: {{item.createTime}}</text>
								<!-- <text class="text1">下单数量: </text> -->
							</view>
							<view class="but"> <button class="btn" :style="spdd(item.id)">{{ buttonText }}</button>
							</view>
						</view>

					</view>
					<view class="content4">
						<view>
							<view>商品信息:</view>
							<view style="display: flex;">
								<view class="left">
									<image :src="item.images" mode="widthFix"></image>
								</view>
								<view class="right">
									<view class="text">
										{{item.name}}
									</view>
									<!-- <view style="display: flex;">
										<view style="flex: 1; margin-left: 10rpx;">积分: {{item.value}}</view>
										<view style="flex: 1; margin-left: 100rpx; margin-top: 5rpx;">×1</view>
									</view> -->
								</view>
							</view>
						</view>
						<view class="text1">
							<text> 收货地址:</text>
							<text>{{this.addressId}}</text>
						</view>
						<!-- <view class="text1">
							<text> 联系电话:</text>
							<text>{{user.phone}}</text>
						</view> -->
						<view class="text1">
							<text>备注:</text>
							<text></text>
						</view>
					</view>
				</view>
				<view class="content5">
					<view class="input" @click="addremark(item.id)">
						<u-icon name="edit-pen" color="#2979ff" size="28"></u-icon>
						<text class="textInput">增加备注信息</text>
					</view>

					<text class="text1" @click="goto('/pages/link/link')">联系客服</text>
				</view>


			</view>
		</view>

		<!-- 已取消 -->
		<view class="order-content">
			<view class="order-card" v-if="selectedTab === 1 && selectedIndex==5 && item.num=='已取消'"
				v-for="(item,index) in shoppingOrder" :key="index">
				<view class="" @click="navigateToorderDetails(index)">


					<view class="content1">
						<text class="text1">订单号: {{item.id}}</text>
					</view>
					<view class="content2">
						<view class="just">
							<view class="cot2">
								<text class="text1"> 下单时间: {{item.createTime}}</text>
								<!-- <text class="text1">下单数量: </text> -->
							</view>
							<view class="but"> <button class="btn" :style="spdd(item.id)">{{ buttonText }}</button>
							</view>
						</view>

					</view>
					<view class="content4">
						<<view>
							<view>商品信息:</view>
							<view style="display: flex;">
								<view class="left">
									<image :src="item.images" mode="widthFix"></image>
								</view>
								<view class="right">
									<view class="text">
										{{item.name}}
									</view>
									<!-- <view style="display: flex;">
										<view style="flex: 1; margin-left: 10rpx;">积分: {{item.value}}</view>
										<view style="flex: 1; margin-left: 100rpx; margin-top: 5rpx;">×1</view>
									</view> -->
								</view>
							</view>
					</view>
					<view class="text1">
						<text> 收货地址:</text>
						<text>{{item.addressId}}</text>
					</view>
					<!-- <view class="text1">
						<text> 联系电话:</text>
						<text>{{user.phone}}</text>
					</view> -->
					<view class="text1">
						<text>备注:</text>
						<text></text>
					</view>
				</view>
			</view>
			<view class="content5">
				<view class="input" @click="addremark(item.id)">
					<u-icon name="edit-pen" color="#2979ff" size="28"></u-icon>
					<text class="textInput">增加备注信息</text>
				</view>

				<text class="text1" @click="goto('/pages/link/link')">联系客服</text>
			</view>


		</view>
	</view>


	</view>



</template>

<script>
	import OrderApi from '@/common/FindingService/OrderApi.js';
	import ShoppingApi from '@/common/FindingService/ShoppingApi.js';
	export default {
		data() {
			return {
				selectedTab: 0, // 默认选中第一个选项卡
				selectedIndex: 0, //选中的按钮变色
				recycleOrderInfo: ['全部', '待收取', '已完成', '已取消'],
				shopOrderInfo: ['全部', '待支付', '待配送', '已完成', '已取消'],
				goodsNum: 1,
				value6: 0,
				type: 'center',
				// 商城订单列表数组
				shoppingOrder:[],
				advanceOrder: [],
				cancelAppointmentOrder: [], //取消预约订单
				successAppointmentOrder: [], //已完成预约订单
				waitAppointmentOrder: [], //待收取预约订单
				data1: [], //把属于你选择的类型的商品全都放到里面后渲染
				orderIndex: '',
				show: false,
				// advanceOrder: [], // 订单列表数组
				cancelledAdvanceOrders: [], // 已取消订单列表数组
				userId: '',
				user:{},
			}
		},
		onLoad(query) {
			const backid = this.$route.query.backid;
			const objString = query.obj;
			const obj = JSON.parse(decodeURIComponent(objString));
			this.advanceOrder[backid].notes = obj;

		},
		onLoad(options) {
			// this.type = options["type"];
			this.typeList = options["typeList"];
			this.storelist = options["storelist"];
			this.index = options["index"];
			this.addresslist = options["addresslist"];
			this.time = options["time"];
		},
		mounted() {
			this.advanceOrder.filter(item => item.zhuangtai === 1)
				.forEach(item => {
					item.num = '待收取';
				});
			this.advanceOrder.filter(item => item.zhuangtai === 2)
				.forEach(item => {
					item.num = '已完成';
				});
			this.advanceOrder.filter(item => item.zhuangtai === 3)
				.forEach(item => {
					item.num = '已取消';
				});

			this.shoppingOrder.filter(item => item.state === 1)
				.forEach(item => {
					item.num = '待支付';
				});
			this.shoppingOrder.filter(item => item.state === 2)
				.forEach(item => {
					item.num = '待配送';
				});
			this.shoppingOrder.filter(item => item.state === 3)
				.forEach(item => {
					item.num = '已完成';
				});
			this.shoppingOrder.filter(item => item.state === 4)
				.forEach(item => {
					item.num = '已取消';
				});
			//全局变量用户ID

		},
		computed: {
			buttonText() {
				if (this.selectedTab === 0) {
					return '回收订单';
				} else if (this.selectedTab === 1) {
					return '商城订单';
				} else {
					return '';
				}
			},
		},
		created() {
			this.userId = uni.getStorageSync('userId');
			this.allAppointmentOrder()
			this.allCancelAppointmentOrder()
			this.allSuccessAppointmentOrder()
			this.WaitAppointmentOrder()

			this.allShoppingOrder()
			this.completeShoppingOrder()
			this.createShoppingOrder()
			this.awaitShoppingOrder()
			this.cancelShoppingOrder()
		},
		beforeDestroy() {
			// 组件销毁前移除事件监听
			uni.$off('deleteItemEvent', this.deleteItem);
		},
		methods: {
			//查询所有预约单
			allAppointmentOrder() {
				OrderApi.queryAllOrderList(this.userId).then(res => {
					this.advanceOrder = res.data.data
				})
			},
			//查询已完成预约单
			allSuccessAppointmentOrder() {
				let params = {
					flag: 1,
					modifyTime: '',
					remark: '',
					userId: this.userId,
					id: ''

				}
				OrderApi.queryOrderList(params).then(res => {
					this.successAppointmentOrder = res.data.data
				})
			},
			//查询已取消预约单
			allCancelAppointmentOrder() {
				let params = {
					flag: 2,
					modifyTime: '',
					remark: '',
					userId: this.userId,
					id: ''

				}
				OrderApi.queryOrderList(params).then(res => {
					this.cancelledAdvanceOrders = res.data.data
				})
			},
			//查询待收取预约单waitAppointmentOrder
			WaitAppointmentOrder() {
				let params = {
					flag: 0,
					remark: '',
					modifyTime: '',
					userId: this.userId,
					id: ''

				}
				OrderApi.queryOrderList(params).then(res => {
					this.waitAppointmentOrder = res.data.data
					console.log('测试', res)
				})
			},
			
			// 查询所有商品订单
			allShoppingOrder(){
				ShoppingApi.allOrderList().then(res=>{
					this.shoppingOrder=res.data.data
					console.log('11:',this.shoppingOrder)
					console.log('99:',res.data.data)
				})
			},
			// 查询已完成商品订单
			completeShoppingOrder(){
				let params = {
					modifyTime: '',
					userId: this.userId,
					id: ''
				
				}
				ShoppingApi.completeOrderList().then(res=>{
					this.completeOrder=res.data.data
					console.log('22:',this.completeOrder)
				})
			},
			
			// 生成订单
			createShoppingOrder() {
				let parmas={
					createTime:'',
					userId:this.userId,
					id:''
				}
				ShoppingApi.createOrder().then(res=>{
					this.createOrder=res.data.data
					console.log('33:',this.createOrder)
				})
			},
			
			// 查询未支付订单
			awaitShoppingOrder(){
				let params = {
					createTime: '',
					userId: this.userId,
					id: ''
				}
				ShoppingApi.awaitOrder().then(res=>{
					this.awaitOrder=res.data.data
					console.log('44:',this.awaitOrder)
				})
			},
			
			// 查询配送订单
			cancelShoppingOrder(){
				let params={
					createTime:'',
					userId:this.userId,
					id:''
				}
				ShoppingApi.cancelOrder().then(res=>{
					this.cancelOrder=res.data.data
					console.log('55:',this.cancelOrder)
				})
			},
			
			// 预约商城标签转换
			selectTab(index) {
				this.selectedTab = index;
				this.selectedIndex = 0;
			},
			// 二级标签转换
			selectOrderInfo(index) {
				this.selectedIndex = index;
			},
			// 状态
			// zt(num) {
			// 	if (num == '待收取' || num == '已完成' || num == '已取消' || num == '待支付' || num == '待配送' || num == '已送达' || num ==
			// 		'已取消') {
			// 		return {
			// 			color: '#BCBCBC'
			// 		};
			// 	}
			// },
			// 按钮
			spdd(id) {
				if (id !== null) {
					return {
						color: '#53B68A',
						backgroundColor: '#D0F4E4'
					};
				}
			},
			navigateToorderDetails(id) {

				if (this.selectedTab === 0) {
					uni.navigateTo({
						url: '/pages/orderform/orderDetails/orderDetails?id=' + id

					});
				}
				if (this.selectedTab === 1) {
					uni.navigateTo({
						url: '/pages/purchase/shoppingOrder/shoppingOrder?id=' + this.id+'&name'+this.name+'&createTime'+this.createTime+'&addressId'+this.addressId
					});
				}
			},
			addremark(id) {
				uni.navigateTo({
					url: '/pages/orderform/addremark/addremark?id=' + id
				});
			},
			open() {},
			close() {
				this.show = false
			},
			// 根据订单 ID 取消订单
			cancelOrder() {
				// 获取订单 ID
				const orderId = 'YOUR_ORDER_ID';

				// 从订单列表中删除订单信息
				this.deleteOrder(orderId, "shoppingOrder");

				// 将取消的订单信息添加到已取消订单列表中
				this.addToCancelledOrders(orderId, "cancelledAdvanceOrders");
			},
			deleteOrder(orderId, orderList) {
				// 在指定订单列表中删除订单信息
				const index = this[orderList].findIndex(item => item.id === orderId);
				if (index !== -1) {
					this[orderList].splice(index, 1);
				}
			},
			addToCancelledOrders(orderId, cancelledOrderList) {
				// 根据订单 id 获取取消的订单信息
				const cancelledOrder = this.shoppingOrder.find(item => item.id === orderId);

				// 新增取消的订单信息到已取消订单列表中
				this[cancelledOrderList].push(cancelledOrder);
			},
			goto(url) {
				uni.navigateTo({
					url: url
				})
			}
		},    
	}
</script>

<style lang="scss" scoped>
	.content4-text {
		display: flex;
		box-sizing: border-box;
		margin-bottom: 18rpx;

		.content4-left {
			white-space: nowrap;
			font-weight: bold;
			margin-right: 10rpx;
		}
	}

	.content4-right-address {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}



	.dingdan {
		font-weight: bold;
		margin-right: 25rpx;
	}

	.tab {
		display: flex;
		justify-content: space-around;
		padding: 8rpx;
		box-shadow: -2rpx 5rpx 10rpx #666;

		.tab-item {
			padding: 16rpx;
			font-size: 33rpx;
			position: relative;
			/* padding-right: 50%; */
			color: #666;
			font-weight: bold;
		}

		.tab-item:nth-child(1)::after {
			content: "";
			position: absolute;
			top: 30%;
			right: -25%;
			height: 50%;
			/* 右边框高度与元素高度一致 */
			border-right: 1px solid #E7E7E7;
			/* 右边框样式 */
		}

		.tab-item:nth-child(2)::after {
			content: "";
			position: absolute;
			top: 30%;
			right: -25%;
			height: 50%;
			/* 右边框高度与元素高度一致 */
			border-right: 1px solid #E7E7E7;
			/* 右边框样式 */
		}

		.tab-item.active {

			color: #7DCCA7;
			font-weight: bold;
		}

	}

	.order-info {
		padding: 10rpx;
		display: flex;
		justify-content: space-around;
		/* background-color: #eee; */
		background-color: #FBFBFB;
		height: 100rpx;

		.info-item {

			/* border: 1px solid #ddd; */
			/* border-radius: 5px; */
			text-align: center;
			margin: 5px;
		}
	}

	.order-infoActive1 .info-item {
		width: 16%;
		font-size: 32rpx;
		/* font-weight: bold; */
		padding: 5rpx;
	}

	.order-infoActive2 .info-item {
		width: 15%;
		font-size: 28rpx;
		/* font-weight: bold; */
		padding-top: 15rpx;
	}

	.order-infoActive3 .info-item {
		width: 20%;
		/* font-weight: bold; */
		font-size: 32rpx;
		padding-top: 13rpx;
	}

	.active1 {
		color: #54C397;
		font-weight: bold;

		/* border-bottom: 6rpx solid #1da25f; */
		.text1 {
			/* text-decoration: underline; */
			padding-bottom: 13rpx;
			border-bottom: 7rpx solid #54C397;
		}
	}

	.just {
		display: flex;
		justify-content: space-between;
		width: 100%;
		align-items: center;
	}

	.order-content {
		font-size: 16px;
		color: #333;
		border: 1px solid #ddd;
		border-radius: 5px;
		background-color: #FBFBFB;
		padding: 0 15rpx;
		height: 100%;

		.order-card1 {
			height: 550rpx;
		}

		.order-card {
			width: 98%;
			font-size: 14px;
			margin: 0 auto;
			margin-bottom: 20rpx;
			padding: 10px;
			/* border: 1px solid rgba(0, 0, 0, 0.5); */
			background-color: white;
			display: flex;
			flex-direction: column;
			box-shadow: -3px 3px 3px rgba(0, 0, 0, .3);
			border-radius: 25rpx;

			.content1 {
				margin: 0 10rpx;
				margin-bottom: 15rpx;
				padding-bottom: 15rpx;
				display: flex;
				justify-content: space-between;
				border-bottom: 1px solid #F3F3F3;

				.text2 {
					display: block;
					width: 120rpx;
					height: 50rpx;
					text-align: center;
					line-height: 50rpx;
					border-radius: 10rpx;
					box-shadow: 3px 3px 3px rgba(0, 0, 0, .3);

					background-color: aliceblue;
					font-Weight: bold;
					color: #BCBCBC;

				}
			}

			.content2 {
				width: 100%;
				display: flex;
				justify-content: space-between;
				/* border-bottom: 1px solid rgba(0, 0, 0, 0.5); */
				margin: 0 10rpx;

				.cot2 {

					.text1 {
						margin-bottom: 20rpx;
						display: flex;

						.text1-left {
							font-weight: bold;
							margin-right: 10rpx;
						}

						.text1-right {
							line-height: 19.2px;
							height: 19.2px;
						}
					}
				}

				.btn {
					font-size: 14px;
					width: 175rpx;
					box-shadow: 3px 3px 3px rgba(0, 0, 0, .3);
				}
			}

			.content3 {
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				margin: 12rpx;
				position: relative;
				border-bottom: 1px solid rgba(0, 0, 0, 0.5);
				background-color: #fafafa;
				word-wrap: break-word;

				.image {
					width: 180rpx;
					height: 180rpx;

				}

				.cot1 {
					display: flex;
					padding-top: 14rpx;
					/* padding-left: 20rpx; */
				}

				.text3 {
					/* line-height: 60rpx; */
				}

				.cot2 {
					width: 450rpx;
					/* margin: 8rpx; */
					height: 60%;
				}

				.cot3 {
					padding: 0rpx 10rpx;
					font-Weight: bold;
					width: 68%;
					position: absolute;
					bottom: 3rpx;
					display: flex;
					justify-content: space-between;

				}
			}

			.content4 {
				margin-left: 10rpx;
				padding-bottom: 10rpx;


				border-bottom: 1px solid #F3F3F3;

				.text1 {
					// font-weight: bold;
					margin-right: 10rpx;
					margin-top: 30rpx;
				}
				.left{
					margin-top: 10rpx;
					margin-bottom: 10rpx;
					width: 150rpx;
				}
				.right{
					margin-left: 30rpx;
				}

			}

			.content5 {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 20rpx 0;
				margin: 0 10rpx;

				.input {
					display: flex;
					align-items: center;

					.textInput {
						font-size: 12px;
						color: #BABABA;
					}
				}

				.text1 {
					padding: 5rpx 10rpx;
					border: 1rpx solid #D2D2D2;
					border-radius: 10rpx;

				}
			}

			.popup {
				// width: 100%;
				padding-top: 100rpx;
				padding-left: 30rpx;
				padding-right: 30rpx;
				height: 700rpx;
				background-color: #fff;

				.jifen {
					// width: 100%;
					font-size: 50px;
					display: flex;
					align-items: center;
					justify-content: center;
				}

				.messege {
					display: flex;
					width: 100%;
					justify-content: space-between;
					padding: 30rpx 0;
					border-bottom: 1px solid #E7E7E7;

					.left {
						font-size: 15px;
						color: #BABABA;
					}

					.right {
						font-size: 15px;
					}
				}

				.btn {
					margin-top: 50rpx;
					background-color: #54C397;
					color: #f8f8f8;
				}
			}
		}
	}
</style>